# Contributor: Curt Tilmes <Curt.Tilmes@nasa.gov>
# Maintainer: Curt Tilmes <Curt.Tilmes@nasa.gov>
pkgname=nqp
pkgver=2022.06
pkgrel=0
pkgdesc="Not Quite Perl"
url="https://github.com/Raku/nqp"
# riscv64 blocked by moarvm
arch="all !s390x !riscv64"
options="!archcheck" # Arch dependencies are embedded
license="Artistic-2.0"
depends="moarvm~$pkgver"
makedepends="perl-utils moarvm-dev~$pkgver"
checkdepends="perl-test-harness"
subpackages="$pkgname-doc"
source="https://github.com/Raku/nqp/releases/download/$pkgver/nqp-$pkgver.tar.gz"

build() {
	perl Configure.pl --prefix=/usr --backends=moar
	make -j"$JOBS"
}

check() {
	# Tests take too long to run on these architectures
	if [ "$CARCH" = "x86" ] || [ "$CARCH" = "armhf" ]; then
		./nqp -V
	else
		export TEST_JOBS=$JOBS
		export HARNESS_VERBOSE=1

		msg "Running $TEST_JOBS parallel test jobs"
		make test
	fi
}

package() {
	make DESTDIR="$pkgdir" install

	install -Dvm644 CREDITS LICENSE README.pod VERSION \
		-t "$pkgdir"/usr/share/doc/"$pkgname"
	cp -vr docs examples "$pkgdir"/usr/share/doc/"$pkgname"/
}

sha512sums="
e044701d77ea6baeb51202a808a86a46e99cae1db03888cd2848424e9dfbb318a82ccf21476050f26e388f3c5137e4389626d52a7434d0ffb1d2c97501e23407  nqp-2022.06.tar.gz
"
